package com.chang.spring6.iocXML.DI;

import org.junit.jupiter.api.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class BookTest {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("beanDI.xml");
        Book bean = context.getBean(Book.class);
        System.out.println(bean);
    }

    @Test
    public void testConstructor() {
        ApplicationContext context = new ClassPathXmlApplicationContext("beanDI.xml");
        Book bean = (Book) context.getBean("bookCon");
        System.out.println(bean);
    }

    @Test
    public void testAuthor() {
        ApplicationContext context = new ClassPathXmlApplicationContext("beanDI.xml");
        Author bean = (Author) context.getBean("author3");
        System.out.println(bean);
    }
}
